<%-- 
    Document   : theme
    Created on : Nov 7, 2014, 8:01:19 PM
    Author     : FASmile
--%>

<%@page contentType="text/html" pageEncoding="UTF-8" errorPage="/Theme/errorPage.jsp"%>
<%@include file="/session.jsp" %>
<%    
class theme {

        String head = "";

        /**
         * Tra ve code trang web
         */
        String show(String title, String body) {
            String data = ""
                    + "<!DOCTYPE html>"
                    + "<html>"
                    + "<head>"
                    + "<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>"
                    + "<title>" + title + "</title>"
                    + "<link href='/Theme/css/Menu.css' type='text/css' rel='stylesheet'>"
                    + "<link href='/Theme/css/Footer.css' type='text/css' rel='stylesheet'>"
                    + "<link href='/Theme/css/main.css' type='text/css' rel='stylesheet'>"
                    + (head == null ? "<script></script>" : head)
                    + "</head>"
                    + "<body>"
                    + Header()
                    + "<div class='main'>"
                    + body
                    + "</div>"
                    + footer()
                    + "</body>"
                    + "</html>";

            return data;
        }

        void setHead(String data) {
            this.head = data;
        }

        /**
         * Trả về code của footer
         */
        String footer() {
            String data = "<footer>"
                    + "<center>"
                    + "<p>Author: Lương Thế Hai </p>"
                    + "</center>"
                    + "</footer>";
            return data;
        }

        String User = null;
        String lvl = null;

        void setSession(String User, String lvl) {
            this.User = User;
            this.lvl = lvl;
        }

        /**
         * Tra ve header HTML code
         */
        String Header() {
            String link;
            String textLog;
            if (User == null || lvl == null) {
                link = "/login.jsp";
                textLog = "Login";
                User = "";
            }
            else
            {
                link = "/logout.jsp";
                textLog = "Logout";
            }

            String data = ""
                    + "<header>"
                    + "<nav id='menu'>"
                    + "<input type='checkbox'/>"
                    + "<label>&#8801;<span>Menu</span></label>"
                    + "<ul>"
                    + "<li><a href='/' rel='nofollow' title=''>"+User+"</a></li>"
                    + "<li><a class='prett' href='/index.jsp' title='index Page'>Index</a>"
                    + "<ul class='menus'>"
                    + "<li><a href='/QLTK' rel='nofollow' title=''>Admin</a></li>"
                    + "<li><a href='/DiDau' title='upload'>Đi Đâu</a></li>"
                    + "<li><a href='/LichTrinh' title='upload'>Lịch Trình</a></li>"
                    + "<li><a href='/NhatKy' title='upload'>Nhật ký</a></li>"
                    + "<li><a href='/ThuHoach' title='upload'>Thu Hoạch</a></li>"
                    + "</ul>"
                    + "</li>"
                    + "<li><a class='trigger2' href='" + link + "' rel='nofollow'>" + textLog + "</a></li>"
                    + "<li><a class='trigger2' href='http://maps.google.com/' onclick='window.open(http://maps.google.com/)' rel='nofollow' target='_blank' title='English'>Google Map</a></li>"
                    + "</ul>"
                    + "</nav>"
                    + "</header>";

            return data;
        }
    }

theme oTheme = new theme();
oTheme.setSession(user, lvl);
%>